﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//Additional
using DO.Common.Messages;
using DO.Domain.Repositories;
using DO.Domain.TransManager;
using DO.Domain.AppServices;

namespace DO.Domain.Services
{
    public class ServiceBase
    {
        protected TResult ExecuteCommand<TResult>(Func<IRepositoryLocator, TResult> command)
            where TResult : class, IResponseDTOEnvelop
        {
            using (ITransManager transactionManager = Container.GlobalContext.TransactionFactory.CreateManager())
            {
                return transactionManager.ExecuteCommand(command);
            }
        }
    }
}
